package com.dq.library.xml;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.net.URL;
import java.util.List;

import org.dom4j.Document;
import org.dom4j.Element;
import org.dom4j.io.SAXReader;

public class XmlFiter {

	public static void main(String[] args) throws Exception {
		
		String rpt="RPT13041,RPT1301,RPT13011,RPT13057";
		URL filePath=XmlFiter.class.getResource("");
		String file=filePath.toString().substring(6)+"menu1.xml";
		System.out.println(file);
		StringBuffer sb=new StringBuffer();
		SAXReader reader = new SAXReader();
		
		reader.setEncoding("utf-8");

		FileInputStream in = new FileInputStream(file);
		Document document = reader.read(in);
		String [] str=rpt.split("\\,");
		for (int i = 0; i < str.length; i++) {
		
			List list=document.selectNodes("//"+str[i]);
			Element node=(Element)list.get(0);
			String link=node.attributeValue("link");
		}
		sb.deleteCharAt(sb.length()-1);
		System.out.println(sb.toString());
		
		
		
		
		
		
		
		
	}
}
